<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原生实现MVVM</title>
</head>
<body>
    <div id="root">
        <div>
            <p>str的字符串值是：{{str}}，</p>
            <p>date的字符串值是：{{info.date}}，</p>
            <input type="text" v-model="str">
            <div>
                <p @click="showMenu">数码产品</p>
                <div v-if="isShowMenu">
                    二级菜单：手机，电脑，Ipad，相机
                </div>
            </div>
        </div>
    </div>

    <script type="module">
        import MVVM from './mvvm.js';
        let mvvm = new MVVM({
            el: '#root',
            data: {
                str: 'hello world',
                info: {
                    date: '2021-11-13',
                    address: 'Beijing Haidian Software North No.57'
                },
                isShowMenu: false
            },
            methods: {
                showMenu(){
                    this.isShowMenu = !this.isShowMenu;
                }
            }
        });
        // console.log('data...', mvvm.str);
        // mvvm.str = 'hello world mvvm.str';
        // console.log('data...', mvvm.str);
        mvvm.info.address = 'Beijing Haidian Software North No.56';
        window.mvvm = mvvm;
    </script>
</body>
</html>